package com.example.xunua_mymusic.utils;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class Sqlite_utils {
    public String checkNmae(MySqliteHelper mySqliteHelper,String name){
        SQLiteDatabase writableDatabase = mySqliteHelper.getWritableDatabase();
        Cursor cursor = writableDatabase.rawQuery("select * from user where name like\'%" + name + "%\'", null);
        cursor.moveToFirst();
        if (cursor.getCount() > 0 && cursor != null) {
            String password=cursor.getString(cursor.getColumnIndex("password"));
            writableDatabase.close();
            return password;
        }else {
            writableDatabase.close();
            return "此用户名不存在";
        }
    }
}
